package controller;

import main.ChatController;

/**
 * Class representing the Connected state
 * implement some of the abstract methods of state
 * Package  controller
 * Project ChatSystemG5 - INSA 4INFOA1 - 2013/2014
 * @author Thomas Vuillemin Martin Conant
 */
public class Connecting extends State {

	/**
	 * Basic constructor of Connecting
	 * @param controller ChatController object
	 */
	public Connecting(ChatController controller) {
		super(controller);
	}
	
	/**
	 * Called the ChatSystem could not open a socket and send a hello message
	 * Change the state to Disconnected
	 */
	public void disconnect() {
		changeState(new Disconnected(controller));
		controller.getModel().setState(DISCONNECTED);
	}
	
	/**
	 * change the state to Connected
	 */
	public void connect(String pseudo)
	{
		changeState(new Connected(controller));
		controller.getModel().setState(CONNECTED);
	}
}
